#include "mainwindow.h"
#include <DApplication>
#include <DWidgetUtil>  //Dtk::Widget::moveToCenter(&w); 要调用它，就得引用DWidgetUtil

DWIDGET_USE_NAMESPACE
int main(int argc, char *argv[])
{
    //解决 root/ubuntu 主题样式走形
    qputenv("XDG_CURRENT_DESKTOP", "Deepin");
     QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);

    // 程序内强制添加 -platformtheme
     // deepin 参数喂给 Qt 让 Qt 正确使用 Deepin 主题修复各种奇怪样式问题
    QVector<char *> fakeArgs(argc + 2);
    char fa1[] = "-platformtheme";
    char fa2[] = "deepin";
    fakeArgs[0] = argv[0];
     fakeArgs[1] = fa1;
     fakeArgs[2] = fa2;

  for (int i = 1; i < argc; i++)
    fakeArgs[i + 2] = argv[i];
  int fakeArgc = argc + 2;


    DApplication::loadDXcbPlugin();  //让bar处在标题栏中
    DApplication a(fakeArgc, fakeArgs.data());

     a.setAttribute(Qt::AA_UseHighDpiPixmaps);
     a.loadTranslator();
     a.setOrganizationName("deepin community");
     a.setApplicationVersion(DApplication::buildVersion("0.6"));
     a.setApplicationAcknowledgementPage("https://gitee.com/Maicss/AppImageToDeb");
     a.setProductIcon(QIcon::fromTheme("a2d"));  //设置Logo
     a.setProductName("a2d");
     a.setApplicationName("软件包转换"); //只有在这儿修改窗口标题才有效

    MainWindow w;
    w.show();

    //让打开时界面显示在正中
    Dtk::Widget::moveToCenter(&w);


    return a.exec();
}
